// PeerCafe namespace
var PC = {};

// TODO: Put all of this into the preferences system...
PC.VERSION = 0.1

// A base class for easy access to common stuff.
PC.Base = function() {};

PC.Base.prototype = {

  initBase: function() {
    // Setup the console logger.
    this.console = Components.classes["@mozilla.org/consoleservice;1"]
      .getService(Components.interfaces.nsIConsoleService);
  },

  // Send a log string to the firefox console.
  log: function pc_log(str) {
    this.console.logStringMessage(str);
    logMessage(str);
  }
};


var pcScriptCache = new Array();

// Easy JavaScript include.
PC.include = function(script_url)
{
	try
	{
		try
		{
			pcScriptCache[script_url].toString();
			return;
		}
		catch (err)
		{
		}
		
		pcScriptCache[script_url] = "true";
		
		var loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
			.getService(Components.interfaces.mozIJSSubScriptLoader);
		loader.loadSubScript(script_url);
	}
	catch (err)
	{
		//apDebug.Dump("Failed to load: " + script_url);
		//apDebug.DumpException(err);
	}
}

